﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tuxedo.Compile
{
	internal class AssemblyAttribute
	{
		public FunctionCall Function { get; private set; }

		public AssemblyAttribute(FunctionCall functionCall)
		{
			this.Function = functionCall;
		}

		public static AssemblyAttribute Parse(TokenStream tokens)
		{
			tokens.PopExpected("[");
			tokens.PopExpected("assembly");
			tokens.PopExpected(":");
			FunctionCall function = Expression.ParseExpression(tokens, false) as FunctionCall;
			if (function == null)
			{
				throw new Exception("Expected function-looking thing");
			}

			tokens.PopExpected("]");
			return new AssemblyAttribute(function);
		}
	}
}
